<template>
	<view >
		<my-header bgColor="bg-gradual-blue" :isBack="true" :isHome="isHome" >
			<block slot="backText">返回</block>
			<block slot="content">历史上的今天</block>
		</my-header>
		<view class="wrap"> 
            <view class="today" v-for="(item,index) in jieList" :key="index" @click="go('./info?id='+item.e_id)">
                <view class="time">时间：{{item.date}}</view>
                <view class="title">标题：{{item.title}}</view>
            </view>
        </view>
        <loading v-if="!is_req"></loading>
		
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
                jieList:[],
                flg:0,
                is_req:false,
                isHome:0
			}
		},
		async onLoad(opt) {
             this.isHome=opt.isHome

            this.initData(opt.content)
		},
		methods: {
			async initData(content){
				const res= await uni.$request({
                    content,
                },"api/api/today")
                if (res.code==200) {
                    this.jieList=res.data
                    uni.setStorageSync('zhougong', res.data)
                    this.is_req=true
                } else{
                    uni.$err(res.msg,1)
                }
            },
            go(url){
                uni.navigateTo({
                     url
                });
            }
		}
	}
</script>

<style lang="scss">
	@import "./main";
</style>